{% extends "admin/base.html" %}
{% block hscript %}
	<script type="text/javascript" src="themes/{{site.theme}}/style/jquery.min.js"></script>
    <script type="text/javascript" src="themes/{{site.theme}}/style/jquery.form.js"></script>
{% endblock %}
{% block content %}
<div id="m_admin">
	<div class="wrap">
		<h2>System Setup and Configuraiton</h2>
		<form id="configForm" action="?a=Config&d=update" method="post">
			<input id="form-id" type="hidden" name="id" />
			<input id="form-value" type="hidden" name="value" />
		</form>
		<table class="form-table">
		{% for config in configs %}
			<tr valign="top">
                <th scope="row">{{config.type}}.{{config.item}} :</th>
                <td>
                	<input type="text" size="45" value="{{config.value}}" id="conf-{{config.id}}" onkeyup="clearInfo()"/>&nbsp;
                	<input type="button" id="btn-upd" value="Save" onclick="doUpd({{config.id}})" class="button button-highlighted"/>
                </td>
			</tr>
		{% endfor %}
		</table>
	</div> 
</div>  		           
{% endblock %}
{% block bscript %}
<script type="text/javascript">
var options = {
	dataType: 'json',
	success : function(data) {
		var hmd = $("#hiddenMessage");
		if (data.type == "error") {
			hmd.html("<div class='error'>" + data.message + "</div>");
		} else {
			hmd.html("<div class='info'>" + data.message + "</div>");
		}
		hmd.show().focus();
	},
};

function clearInfo() {
	$("#hiddenMessage").hide();
}
function doUpd(id) {
	frm = document.getElementById("configForm");
	frm.id.value=id;
	frm.value.value = $("#conf-" + id).val();
	$("#configForm").ajaxSubmit(options);
}
</script>
{% endblock %}